package com.pentofab.payrollmanagement.ui.controller;

import java.net.URL;
import java.util.ResourceBundle;

import com.pentofab.payrollmanagement.ui.dialog.DialogFX;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.control.TextField;

public abstract class AbstractUIController implements Initializable {
	
	private String parent;

	public void setPartent(String parent) {
		this.parent = parent;
	}

	public String getParent() {
		return parent;
	}

	public abstract Parent getView();

	public abstract String getTitle();

	public abstract void refreshUI(Object... args);

	protected void showError(String message) {
		DialogFX.errorDialog(message);
	}

	protected void showInfo(String message) {
		DialogFX.infoDialog(message);
	}
	protected boolean showConfirmDialog(String message) {
		return (DialogFX.questionoDialog(message) == 0) ? true : false;
	}
	protected void moveFocusToComp(final Node component) {

		Platform.runLater(new Runnable() {
			@Override
			public void run() {
				component.requestFocus();
			}
		});
	}
	@Override
	public void initialize(URL arg0, ResourceBundle arg1) {

		
	}
}
